Las Reliquias de Tolti Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section E(g) - Terra Incognita

[Al igual que "Solid Rock", "Terra Incognita" es una habitación que nunca se visita. La regla es que una salida del laberinto conduce a T.I. si y sólo si llevaría a una posición en la cuadrícula la cual sigue estando dentro de los límites del laberinto, pero que en la cual ninguna habitación ha sido colocada. Excepto para los casos especiales de Hedge Archway que une el laberinto con el mundo exterior, todas las salidas conducen tanto a Roca Solida (no hay camino), Terra Incognita (tratamos de extender el labnerinto si se toma una salida) o a cualquier otra habitación del laberinto.

La frase "position ... at ..." es crucial para establecer la mecánica del juego, porque mantiene estas reglas acerca de las salidas y comprueba si tanto dos habitaciones adjacentes tienen salidas que las unen o no. Nota que las escaleras arriba y abajo siempre funcionan (la dirección "vertical"), pero aveces son invisibles y secretas desde el otro lado - una excentricidad del juego de tablero original "Sorcerer's Cave" el cual se tributa aquí.]

Terra Incognita is a room.

Egress relates a room (called the place) to a direction (called that way) when the room that way from the place is a room. The verb to exit (it exits) implies the egress relation.

To position (new room - a room) at (grid ref - a spatial coordinate):
    change the grid position of the new room to the grid ref;
    repeat with this way running through vectorial directions
    begin;
        let the further position be the vector sum of the grid ref and the vector of this way;
        [say "In direction [this way], the position would be [further position].";]
        if the further position is not <0,0,0>
        begin;
            let the further room be the room at the further position;
            if the further room is Solid Rock
            begin;
                if the new room exits this way then change this way exit of the new room to Terra Incognita;
            otherwise;
                let the reverse way be the opposite of this way;
                if this way is vertical or the new room exits this way
                begin;
                    if the further room exits the reverse way
                    begin;
                        change this way exit of the new room to the further room;
                        change the reverse way exit of the further room to the new room;
                    otherwise;
                        change this way exit of the new room to Solid Rock;
                    end if;
                otherwise;
                    if the further room exits the reverse way, change the reverse way exit of the further room to Solid Rock;
                end if;
            end if;
        end if;
    end repeat.